package ControlLayer;
import java.util.ArrayList;
import ControlLayer.*;
import ModelLayer.*;
//model layer package has to be imported


public class AddressCtr
{
    
    //declare instance variables to reference containers
     private AddressBook addressBook;
 
        public AddressCtr()
    {
        addressBook = new AddressBook();
        
    }
    
    

    //Dummy implementation: after implementing the model layer 
    //objects of class Person are to be returned, not String
    public Person getPerson(long id)
    {
        
         Person person= addressBook.findPerson(id);
         return person;
    }
    
        public void updatePerson(long id, String name, String address)
    {
        Person person = getPerson(id);
        person.setName(name);
        person.setAddress(address);
    }
    

    public void createPersonDeveloper2(long id, String name, String address, String postalCode, String city, String phone)
      
    {
    }

    public void createPerson(long id, String name, String address, String postalCode, String city, String phone)
    {   
       Person person = new Person(id, name, address, postalCode, city, phone);
       addressBook.addPerson(person);
    }
    
    public void deletePerson(long id)
    {
        //search for the person and delete the object from the container
        addressBook.deletePerson(id);
    }
    public ArrayList listAllPersons()
    {
        addressBook.makePersonList();
        return null;
    }
   
}
